<!DOCTYPE html>
<html lang=en>
    <head>
        <meta charset=utf-8>
        <meta http-equiv=X-UA-Compatible content="IE=edge">
        <meta name=viewport content="width=device-width,initial-scale=1">
        <title>Welcome</title>
    </head>
<body>
	<div id="context">
		<div id="ph">
			<input type="text" id="phone" />
			<p></p>
			<input id="cl" type="button" onclick="call();" value="拔 打" />
		</div>
		<p></p>
		<div id="sp">
			<input id="btn" type="button" onclick="openUrl();" value="打 开" />
        </div>
        <div id="finish">
            <input id="btn" type="button" onclick="back();" value="返回" />
        </div>
		<p></p>
		<div id='rs'>
			<a id="barcodes">huhuhu</a>
		</div>
		<p></p>
		<div id="bar">
			<input id="sn" type="button" onclick="openBarcode();" value="条 码" />
			<p></p>
			<input id="sn" type="button" onclick="openBarcodes();" value="连 续" />
		</div>
        <div id="logout">
            <input id="btn" type="button" onclick="logout();" value="注销" />
        </div>
	</div>
	<div id="bottom"></div>
</body>
<script type="text/javascript">
function openUrl() {
window.js.handler.openUrlWithFilterUrl("https://www.baidu.com", "百度")
};

function openBarcode() {
    window.js.handler.barcode("callback");
};


function openBarcodes() {
    window.js.handler.barcodes("callbackcodes");
};

function callbacks(id, barcodes) {
    document.getElementById(id).innerHTML = barcodes.join('<br />');
};

function callbackcodes(barcodes) {
    callbacks("barcodes", barcodes);
};

function callback(v) {
    document.getElementById('barcodes').innerHTML = v
};

function callbackHello(text) {
    document.getElementById('barcodes').innerHTML = text
};

function logout() {
    window.js.handler.logout()
};

function call() {
    try {
        var phone = document.getElementById('phone').value;
        if (window.js.handler != undefined) {
                window.js.handler.call(phone);
        }
    } catch (err) {
        alert(err);
    }
};

function back() {
    window.js.handler.back();
}

function finish() {
    window.js.handler.finish(null);
};
</script>
</html>
